package com.xwj.dto;

import org.apache.commons.lang3.StringUtils;

import java.beans.Transient;
import java.io.Serializable;

public class RegisterUserDto implements Serializable {
    private static final long serialVersionUID = -8599447312571927223L;

    private String id;

    private String name;

    private String sex;

    private String minAge;

    private String maxAge;

    private String phone;

    private String idCard;

    private String address;

    private String mail;

    private String minTime;

    private String maxTime;

    public RegisterUserDto() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMinAge() {
        return minAge;
    }

    public void setMinAge(String minAge) {
        this.minAge = minAge;
    }

    public String getMaxAge() {
        return maxAge;
    }

    public void setMaxAge(String maxAge) {
        this.maxAge = maxAge;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }


    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getMinTime() {
        return minTime;
    }

    public void setMinTime(String minTime) {
        this.minTime = minTime;
    }

    public String getMaxTime() {
        return maxTime;
    }

    public void setMaxTime(String maxTime) {
        this.maxTime = maxTime;
    }

    @Transient
    public void setCreateTime(String createTime) {
        if (StringUtils.isBlank(createTime))
            return;
        String[] str = createTime.split(" - ");
        minTime = str[0];
        maxTime = str[1];
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        if (StringUtils.isNotBlank(id))
            builder.append(id);
        if (StringUtils.isNotBlank(name))
            builder.append(name);
        if (StringUtils.isNotBlank(sex))
            builder.append(sex);
        if (minAge != null)
            builder.append(minAge);
        if (maxAge != null)
            builder.append(maxAge);
        if (StringUtils.isNotBlank(phone))
            builder.append(phone);
        if (StringUtils.isNotBlank(idCard))
            builder.append(idCard);
        if (StringUtils.isNotBlank(address))
            builder.append(address);
        if (StringUtils.isNotBlank(mail))
            builder.append(mail);
        if (StringUtils.isNotBlank(minTime))
            builder.append(minTime);
        if (StringUtils.isNotBlank(maxTime))
            builder.append(maxTime);
        return builder.toString();
    }
}
